-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A couple of small bugfixes #194
Conversation
Enable JSON reports for NO v7 Fix a couple of places where the JSON->text report wasn't quite right. Fix a bug where the inactive turns handling was slightly wonky in the JSON report.
@@ -409,7 +409,7 @@ void Faction::build_json_report(json& j, Game *game, size_t **citems) { | |||
j["administrative"]["show_unit_attitudes"] = (showunitattitudes != 0); | |||
|
|||
if(!password_unset) j["administrative"]["password"] = password->const_str(); | |||
if(Globals->MAX_INACTIVE_TURNS) { | |||
if(Globals->MAX_INACTIVE_TURNS != -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1 is the signifier for ignore turn inactivity, and if(-1) evaluates to true, so this was a bug but unlikely to get caught since noone actually runs with -1 as the inactive turn setup.
@@ -524,9 +524,9 @@ void TextReportGenerator::output(ostream& f, const json& report, bool show_regio | |||
|
|||
bool show_unit_attitudes = false; | |||
if (report.contains("administrative")) { | |||
if (!report["administrative"].contains("times_sent")) | |||
if (!report["administrative"].contains("times_sent") || !report["administrative"]["times_sent"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd initially made the assumption here that the field wouldn't be output at all if it was false, but the actual generation
code always created the field and set it's value to either true or false. For safety it will now check existence and/or the value being truthful.
In the case of times, if the value isn't set OR it's set to false then the times isn't being set. For the password, if it's set AND it's set to true then we output the warning.
Found this while testing the new website with an downloaded report for a new faction where it had a password set..
This wasn't caught in unit tests or snapshot tests as they don't set faction passwords so they (as expected) had this warning.
Enable JSON reports for NO v7
Fix a couple of places where the JSON->text report wasn't quite right. Fix a bug where the inactive turns handling was slightly wonky in the JSON report.